mod grpc_service;

use tonic::transport::Server;
use proto_lib::proto_common::user_service;
use proto_lib::proto_common::user_service::user_service_server::{
    UserService,
    UserServiceServer,
};
use proto_lib::utils::test_utils;
use crate::grpc_service::user_service::GrpcUserService;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {

    println!("Hello, world!");

    test_utils::print_username();

    //启动grpc服务器 port:9000
    let addr = "[::1]:9000".parse()?;

    let  user_service = GrpcUserService::default();

    Server::builder()
        .add_service(UserServiceServer::new(user_service))
        .serve(addr)
        .await?;

    Ok(())
}
